package com.zhang.test_zhang.controller;

import com.zhang.test_zhang.entity.ShoppingCart;
import com.zhang.test_zhang.service.ShoppingCartService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/shoppingCart")
@Slf4j
public class ShoppingCartController {

    @Autowired
    private ShoppingCartService shoppingCartService;

    //添加购物车
    @PostMapping("/save")
    public String save(@RequestBody ShoppingCart shoppingCart){
        log.info("添加购物车：{}",shoppingCart);
        return shoppingCartService.save(shoppingCart);
    }
}
